<?php
 
class TransactionCentral_Card_Transaction_Debit extends TransactionCentral_CurlTransaction
{
    protected $card_trans;
    
    public function __construct(TransactionCentral_Card_Transaction $card_trans)
    {
         $this->card_trans = $card_trans;
    }
    
    public function process()
	{
	    $card_trans = &$this->card_trans;
	    
	    if(
		    $card_trans->getAmount()            == '' || 
		    $card_trans->getCardNumber()        == '' || 
		    $card_trans->Expiration()           == '' 
		  )
		{
			throw new Exception('Amount, Card Number, and Expiration must be set.');
		}
		
		return self::curlTransaction(TransactionCentral_Card_Transaction::CC_TRANS_URL, 
		                             TransactionCentral_Card_Transaction::CC_SALE, array(
                                		                                                    'MerchantID'	=>  TransactionCentral_Transaction::MERCH_ID,
                                    														'RegKey'		=>  TransactionCentral_Transaction::REG_KEY,
                                															'Amount' 		=> 	$card_trans->getAmount(),
                                															'CardNumber' 	=>	$card_trans->getCardNumber(),
                                															'Expiration' 	=> 	$card_trans->getExpiration(),
                                															'RefID' 		=> 	$card_trans->getRefId(),
                                															'CardHolderName'=> 	$card_trans->getCardHolderName(),
                                															'Address' 		=> 	$card_trans->getAddress(),
                                															'ZipCode' 		=> 	$card_trans->getZipCode(),
                                															'TrackData' 	=> 	$card_trans->getTrackData()
                                														));
    }
    
   
}